package com.ffcs.crmd.tsp.common.netty;

import com.ffcs.crmd.tsp.common.netty.enu.NettyEventType;

import io.netty.channel.Channel;

/**
 * 
 * 功能说明:netty事件对象
 *
 * @author ZHONGFUHUA
 * 
 * @since 1.0.0-SNAPSHOT
 *
 */
public class NettyEvent {
    
    /**
     * 事件类型
     */
    private NettyEventType type;
    
    /**
     * 远程地址
     */
    private String         remoteAddr;
    
    /**
     * 远程通道
     */
    private Channel        channel;
    
    public NettyEvent(NettyEventType type, String remoteAddr, Channel channel) {
        this.type = type;
        this.remoteAddr = remoteAddr;
        this.channel = channel;
    }
    
    /**
     * 功能说明: 获取事件类型
     *
     * @return type 事件类型
     */
    public NettyEventType getType() {
        return type;
    }
    
    /**
     * 功能说明: 设置事件类型
     *
     * @param type 事件类型
     */
    public void setType(NettyEventType type) {
        this.type = type;
    }
    
    /**
     * 功能说明: 获取远程地址
     *
     * @return remoteAddr 远程地址
     */
    public String getRemoteAddr() {
        return remoteAddr;
    }
    
    /**
     * 功能说明: 设置远程地址
     *
     * @param remoteAddr 远程地址
     */
    public void setRemoteAddr(String remoteAddr) {
        this.remoteAddr = remoteAddr;
    }
    
    /**
     * 功能说明: 获取远程通道
     *
     * @return channel 远程通道
     */
    public Channel getChannel() {
        return channel;
    }
    
    /**
     * 功能说明: 设置远程通道
     *
     * @param channel 远程通道
     */
    public void setChannel(Channel channel) {
        this.channel = channel;
    }
    
    @Override
    public String toString() {
        return "NettyEvent [type=" + type + ", remoteAddr=" + remoteAddr + ", channel=" + channel
            + "]";
    }
}
